/* 基础样式重置 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Microsoft YaHei', sans-serif;
    padding: 20px;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    height: 80vh;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    margin: auto;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-content::-webkit-scrollbar {
    width: 8px;
}

.chat-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.input-area {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 15px;
    padding: 20px;
    flex-wrap: nowrap;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(250, 250, 250, 0.8);
    backdrop-filter: blur(5px);
}

.model-select {
    min-width: 180px;
    max-width: 300px;
    flex-shrink: 0;
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: white;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.model-select:hover {
    border-color: #1890ff;
    box-shadow: 0 2px 12px rgba(24, 144, 255, 0.1);
}

.input-group {
    flex: 0 1 600px;
    display: flex;
    gap: 12px;
}

.message-input {
    flex-grow: 1;
    min-width: 300px;
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message-input:focus {
    outline: none;
    border-color: #4a6baf;
    box-shadow: 0 0 0 2px rgba(74, 107, 175, 0.2);
}

.message-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.message-input.empty {
    border-color: #ff4d4f;
}

.message-input.empty::placeholder {
    color: #ff4d4f;
}

.send-button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
}

.send-button:not(.disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

.send-button:not(.disabled):active {
    transform: translateY(0);
}

.send-button.disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.send-button.disabled:hover {
    transform: none;
    box-shadow: none;
}

.message-input:placeholder-shown {
    border-color: #ff4d4f;
}

.message-input:placeholder-shown::placeholder {
    color: #ff4d4f;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 16px;
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
    color: white;
    border-radius: 16px 16px 4px 16px;
    margin-right: 8px;
}

.ai-message {
    align-self: flex-start;
    color: #333;
    border-radius: 16px 16px 16px 4px;
    margin-left: 8px;
    border: 1px solid #e8e8e8;
    padding-top: 16px;
    position: relative;
    background: #f8f9fa;
}


/* 文心一言消息样式 */

.ai-message.model-ernie {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.2);
}


/* 深度求索消息样式 */

.ai-message.model-deepseek {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.2);
}


/* 通义千问消息样式 */

.ai-message.model-qwen {
    background: rgba(156, 39, 176, 0.1);
    border-color: rgba(156, 39, 176, 0.2);
}

.ai-message::before {
    content: 'AI';
    position: absolute;
    top: 8px;
    left: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    opacity: 0.8;
}

.message-content {
    margin-bottom: 4px;
    word-wrap: break-word;
}

.message-time {
    font-size: 12px;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.ai-message .message-time {
    color: #666;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .chat-container {
        height: 90vh;
        margin: 10px;
        border-radius: 12px;
    }
    .input-area {
        flex-direction: column;
        padding: 15px;
    }
    .model-select,
    .input-group {
        width: 100%;
    }
    .message-input {
        width: 100%;
    }
    .send-button {
        width: 100%;
    }
}


/* 加载动画 */

.typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f0f7ff;
    border-radius: 16px 16px 16px 4px;
    margin-left: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: fit-content;
    border: 1px solid #e6f4ff;
    margin-bottom: 16px;
}

.typing-indicator.show {
    display: flex;
}

.typing-text {
    color: #1890ff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-text::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%231890ff"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/></svg>') no-repeat center;
    background-size: contain;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #1890ff;
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}


/* 禁用状态样式 */

.input-area.disabled {
    opacity: 0.7;
    pointer-events: none;
}

.message-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.message-model {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    color: white !important;
}


/* 文心一言模型标签样式 */

.message-model.model-ernie {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%) !important;
}


/* 深度求索模型标签样式 */

.message-model.model-deepseek {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%) !important;
}


/* 通义千问模型标签样式 */

.message-model.model-qwen {
    background: linear-gradient(135deg, #9C27B0 0%, #BA68C8 100%) !important;
}

.message-model::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/></svg>') no-repeat center;
    background-size: contain;
}

.user-message .message-footer {
    justify-content: flex-end;
}

.ai-message .message-footer {
    justify-content: space-between;
}

.system-message {
    align-self: center;
    background: #fff3f3;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(255, 77, 79, 0.1);
    max-width: 90%;
    text-align: center;
}

.api-key-link {
    color: #1890ff;
    text-decoration: none;
    border-bottom: 1px dashed #1890ff;
    transition: all 0.3s ease;
}

.api-key-link:hover {
    color: #40a9ff;
    border-bottom-color: #40a9ff;
}

.file-display-area {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.file-display-area:hover {
    background-color: #f1f3f5;
    border-color: #d0d0d0;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.file-icon {
    color: #4a6baf;
    font-size: 14px;
    flex-shrink: 0;
}

.file-name {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}


/* 清除文件按钮样式 - 美化版 */

.clear-file-button {
    background: none;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-file-button:hover {
    background-color: #f0f0f0;
    color: #ff6b6b;
    transform: scale(1.1);
}


/* 上传按钮样式 - 美化版 */

.upload-button {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0 12px;
    font-size: 18px;
    transition: all 0.2s ease;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-button:hover {
    color: #4a6baf;
    transform: scale(1.1);
}


/* 调整输入组布局 */

.input-group {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 5px;
}

.message-input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.message-input:focus {
    outline: none;
    border-color: #4a6baf;
    box-shadow: 0 0 0 2px rgba(74, 107, 175, 0.2);
}


/* 文件列表区域样式 */

.file-list-area {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 10px 15px;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: #495057;
}

.clear-all-files-button {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-all-files-button:hover {
    background-color: #ffebee;
    transform: scale(1.1);
}

.file-list-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #e9ecef;
    border-radius: 6px;
    font-size: 13px;
    color: #495057;
    transition: all 0.2s ease;
}

.file-item:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.file-item .file-icon {
    color: #4a6baf;
    font-size: 16px;
}

.file-item .file-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.file-item .file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.file-item .file-size {
    font-size: 12px;
    color: #6c757d;
}

.file-item .remove-file {
    color: #dc3545;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.file-item .remove-file:hover {
    background-color: #ffebee;
    opacity: 1;
}

.store-list {
    list-style: none;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 10px 0;
}

.store-item {
    padding: 12px 20px;
    background: white;
    border-radius: 6px;
    margin: 8px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.store-info {
    color: #495057;
    font-size: 14px;
    line-height: 1.6;
    padding: 4px 0;
}

.store-info strong {
    color: #1a73e8;
    font-weight: 600;
}

.user-message .message-footer {
    justify-content: flex-end;
}

.ai-message .message-footer {
    justify-content: space-between;
}

.system-message {
    align-self: center;
    background: #fff3f3;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(255, 77, 79, 0.1);
    max-width: 90%;
    text-align: center;
}

.api-key-link {
    color: #1890ff;
    text-decoration: none;
    border-bottom: 1px dashed #1890ff;
    transition: all 0.3s ease;
}

.api-key-link:hover {
    color: #40a9ff;
    border-bottom-color: #40a9ff;
}

.file-display-area {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.file-display-area:hover {
    background-color: #f1f3f5;
    border-color: #d0d0d0;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.file-icon {
    color: #4a6baf;
    font-size: 14px;
    flex-shrink: 0;
}

.file-name {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}


/* 清除文件按钮样式 - 美化版 */

.clear-file-button {
    background: none;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-file-button:hover {
    background-color: #f0f0f0;
    color: #ff6b6b;
    transform: scale(1.1);
}


/* 上传按钮样式 - 美化版 */

.upload-button {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0 12px;
    font-size: 18px;
    transition: all 0.2s ease;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-button:hover {
    color: #4a6baf;
    transform: scale(1.1);
}


/* 调整输入组布局 */

.input-group {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 5px;
}

.message-input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.message-input:focus {
    outline: none;
    border-color: #4a6baf;
    box-shadow: 0 0 0 2px rgba(74, 107, 175, 0.2);
}